/**
 * 
 */
package com.scpii.universal.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.scpii.universal.constant.GenericConstants;
import com.scpii.universal.hibernate.dao.TypeDao;
import com.scpii.universal.hibernate.entity.TypeTab;
import com.scpii.universal.service.TypeService;

/**
 * genericWeb
 * @author weny
 * 2012-7-8下午09:55:39
 */
@Service
public class TypeServiceImpl extends BaseServiceImpl<TypeTab, Integer> implements
		TypeService {
   @Resource
	private TypeDao typeDao;
	@Resource
	public void setBaseDao(TypeDao typeDao) {
		super.setBaseDao(typeDao);
	}
	@Override
	public Map<Integer, String> getTypeListByParentId(Integer parentId) {
		Map<String, Object> argsMap = new HashMap<String, Object>();
		argsMap.put("intParentTypeId", parentId);
		argsMap.put("intDeleteSign", GenericConstants.DELETE_SIGN_EXIST);
		// 获取微博分类信息
		List<TypeTab> tabList = typeDao.hqlGetList(
				" from TypeTab t where t.intParentTypeId=:intParentTypeId and t.intDeleteSign=:intDeleteSign",
				argsMap);
		Map<Integer, String> map = new HashMap<Integer, String>();
		if (tabList != null && tabList.size() > 0) {

			for (TypeTab tab : tabList) {
				map.put(tab.getIntType(), tab.getVarTypeName());
			}
		}

		return map;
	}
}
